function newUserGrid()
{
  var user_record = Ext.data.Record.create([
    {name: "id", mapping:"id", type: "string"},
    {name: "username", mapping:"username", type: "string"},
    {name: "password", mapping:"password", type: "string"},
    {name: "email", mapping:"email", type: "string"},
    {name: "credit", mapping:"credit", type: "string"},
    {name: "date", mapping:"date", type: "string"}]);

  var data_proxy = new Ext.data.DWRProxy(Admin.getUsers, true);

	var cm = new Ext.grid.ColumnModel(
      [{header: 'UserName', width: 250, sortable: true, dataIndex: 'username'},
       {header: 'Password', width: 250, sortable: true, dataIndex: 'password'},
       {header: 'eMail',    width: 250, sortable: true, dataIndex: 'email'},
       {header: 'Credit',   width: 250, sortable: true, dataIndex: 'credit'},
       {header: 'Date',     width: 250, sortable: true, dataIndex: 'date'}]
  );

  var ds = initDataSource(user_record, data_proxy);
  ds.load({params:{start:0, limit:22}, arg:[]});
  return buildGrid("User", ds, cm);
};
	//Ext.onReady(GridUI.init, GridUI, true);
function initDataSource(user_record, data_proxy)
{
  return new Ext.data.Store({
      proxy: data_proxy,
      reader: new Ext.data.ListRangeReader(
        {id:'id', totalProperty:'totalSize'}, user_record),
      remoteSort: true
    });
  //ds.on("load", function () {});  
  //return ds;
}

function buildGrid(title, ds, cm)
{
  var g = new Ext.grid.GridPanel({
    id: 'id-' + title,
    source: ds,
    cm: cm,
    sm: new Ext.grid.CheckboxSelectionModel(),
    viewConfig: {forceFit:true}
  });
  //g.render();
  return g;
}
